package com.vincent.kdp.js;

import android.content.Context;
import android.content.Intent;
import android.webkit.JavascriptInterface;

import com.vincent.kdp.Activity.CostDetailActivity;
import com.vincent.kdp.Activity.RepairGoodsActivity;
import com.vincent.kdp.util.BaseParam;

/**
 * Created by pg on 2017/1/23.
 */

public class CostOrderDetailOperator {
    private CostDetailActivity context;

    private String consumeNumber;

    public CostOrderDetailOperator(CostDetailActivity context, String consumeNumber) {
        this.context = context;
        this.consumeNumber = consumeNumber;
    }

//    @JavascriptInterface
//    public String getDeviceId(){
//        System.out.print("CCC"+BaseParam.getDeviceId()     );
//        return BaseParam.getDeviceId();
//    }

    @JavascriptInterface
    public String getConsumeNumber(){
        System.out.print("cccccccc"+consumeNumber);
        return consumeNumber;
    }

    /**
     * 查看维修
     */
    @JavascriptInterface
    public void addRepaire(final String barCode){
        context.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Intent intent=new Intent(context,RepairGoodsActivity.class);
                intent.putExtra("barcode",barCode);
                context.startActivity(intent);
            }
        });

    }

}
